//
//  OrderRefundView.m
//  MobileShoppingMall
//
//  Created by 冯传昌 on 2021/5/8.
//  Copyright © 2021 冯传昌. All rights reserved.
//

#import "OrderRefundView.h"

@interface OrderRefundView()

@property (nonatomic,strong) UIView *topLineV;
@property (nonatomic,strong) UIView *bottomLineV;

@property (nonatomic,strong) UIButton *pasteBtn;

@property (nonatomic,strong) UIButton *serviceBtn;//联系平台

@end

@implementation OrderRefundView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self initUI];
    }
    return self;
}

#pragma mark - UI
-(void)initUI{
    [self addSubview:self.topLineV];
    [self addSubview:self.bottomLineV];
    
    NSArray *titles = @[@"退款原因",@"退款金额",@"退款时间",@"退款编号"];
    for (int i = 0; i<4; i++) {
        UILabel *lb = [[UILabel alloc] initWithFrame:CGRectMake(15, 20+i*30, 80, 20)];
        lb.font = FontSet(14);
        lb.textColor = MainGrayTextColor;
        lb.text = titles[i];
        lb.textAlignment = NSTextAlignmentLeft;
        [self addSubview:lb];
        
        UILabel *lb1 = [[UILabel alloc] initWithFrame:CGRectMake(lb.right+10, lb.top, ScreenWidth-160, 20)];
        lb1.font = FontSet(14);
        lb1.textColor = MainGrayTextColor;
        lb1.textAlignment = NSTextAlignmentLeft;
        [self addSubview:lb1];
        
        if (i == 0) {
            self.refundReasonLB = lb1;
            self.leftLB1 = lb;
        }else if (i == 1) {
            self.refundPriceLB = lb1;
            self.leftLB2 = lb;
        }else if (i == 2) {
            self.refundTimeLB = lb1;
            self.leftLB3 = lb;
        }else if (i == 3) {
            self.refundNoLB = lb1;
            self.leftLB4 = lb;
        }
    }
}
#pragma mark - lazy
- (UIView *)topLineV{
    if (!_topLineV) {
        _topLineV = [[UIView alloc] initWithFrame:CGRectMake(15, 0, ScreenWidth-30, 2)];
        _topLineV.backgroundColor = MainBackColor;
    }
    return _topLineV;
}
- (UIView *)bottomLineV{
    if (!_bottomLineV) {
        _bottomLineV = [[UIView alloc] initWithFrame:CGRectMake(15, 160, ScreenWidth-30, 2)];
        _bottomLineV.backgroundColor = MainBackColor;
    }
    return _bottomLineV;
}
- (UIButton *)pasteBtn{
    if (!_pasteBtn) {
        _pasteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _pasteBtn.frame = CGRectMake(ScreenWidth - 55, 20, 40, 20);
        _pasteBtn.clipsToBounds = YES;
        _pasteBtn.layer.cornerRadius = 10;
        _pasteBtn.layer.borderWidth = 1;
        _pasteBtn.layer.borderColor = MainPureColor(220).CGColor;
        [_pasteBtn.titleLabel setFont:FontSet(11)];
        [_pasteBtn setTitle:@"复制" forState:normal];
        [_pasteBtn setTitleColor:MainPureColor(119) forState:normal];
        [_pasteBtn addTarget:self action:@selector(pasteClick) forControlEvents:UIControlEventTouchUpInside];
    }
    return _pasteBtn;
}
- (UIButton *)serviceBtn{
    if (!_pasteBtn) {
        _pasteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _pasteBtn.frame = CGRectMake(ScreenWidth/2-80, self.bottomLineV.bottom + 10, 160, 30);
        [_pasteBtn.titleLabel setFont:FontSet(13)];
        [_pasteBtn setTitle:@"联系平台" forState:normal];
        [_pasteBtn setTitleColor:RGB(255, 188, 62) forState:normal];
        [_pasteBtn addTarget:self action:@selector(serviceClick) forControlEvents:UIControlEventTouchUpInside];
    }
    return _pasteBtn;
}

#pragma mark - SEL
//复制到剪切板
-(void)pasteClick{
    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    pasteboard.string = self.refundNoLB.text;
}
//联系平台
-(void)serviceClick{
    
}

@end
